1 00:00:00,930 --> 00:00:01,190 All right. 2 00:00:01,200 --> 00:00:03,960 Now, let's go ahead and add a muzzle flash to our pistol. 3 00:00:03,990 --> 00:00:05,070 Here's a demo. 4 00:00:05,400 --> 00:00:06,180 Boom. 5 00:00:06,750 --> 00:00:07,820 That's pretty cool. 6 00:00:07,830 --> 00:00:09,690 Let's go ahead and get started. 7 00:00:10,260 --> 00:00:11,700 I'm going to grab my gun. 8 00:00:11,700 --> 00:00:13,450 I'm going to go to the Explorer window. 9 00:00:13,470 --> 00:00:16,480 I'm going to go down to starter pack in starter pack. 10 00:00:16,500 --> 00:00:18,040 There's my simple pistol. 11 00:00:18,060 --> 00:00:20,550 I'm going to left click and hold. 12 00:00:20,580 --> 00:00:23,190 I'm going to drag it up to my workspace. 13 00:00:23,190 --> 00:00:24,300 Let go. 14 00:00:24,300 --> 00:00:27,010 And now it's in the workspace somewhere out here. 15 00:00:27,030 --> 00:00:29,370 I don't know where, but it is selected. 16 00:00:29,370 --> 00:00:33,480 So if I hit the key, I frame in pretty cool. 17 00:00:33,690 --> 00:00:39,780 All right, now I'm going to add a particle emitter that's going to shoot one particle every time I 18 00:00:39,780 --> 00:00:40,950 shoot the pistol. 19 00:00:40,980 --> 00:00:43,230 Let's open our sample pistol. 20 00:00:43,410 --> 00:00:44,950 I'm going to go to the gun part. 21 00:00:44,970 --> 00:00:47,400 That's the big mesh part, right? 22 00:00:47,400 --> 00:00:49,270 And I'm going to hit the plus sign. 23 00:00:49,290 --> 00:00:51,900 I'm going to hit an 84 attachment. 24 00:00:52,110 --> 00:00:55,110 I'm going to add an attachment to my gun part. 25 00:00:55,650 --> 00:00:58,670 If you click on attachment, that's where it is. 26 00:00:58,680 --> 00:01:00,630 I'm going to move this attachment. 27 00:01:00,630 --> 00:01:03,600 This attachment is going to hold my particle emitter. 28 00:01:04,170 --> 00:01:05,940 There we go. 29 00:01:06,310 --> 00:01:08,040 I'll move it, like right here. 30 00:01:09,390 --> 00:01:09,690 All right. 31 00:01:09,690 --> 00:01:19,500 I'm going to rename my attachment to Flash attachment Flash eight, and then on flash eight, hit the 32 00:01:19,500 --> 00:01:20,190 plus. 33 00:01:20,190 --> 00:01:23,730 Add a particle emitter if you don't see it, do PRP. 34 00:01:23,760 --> 00:01:24,660 There we go. 35 00:01:24,900 --> 00:01:27,090 And that's a lot of particles. 36 00:01:28,910 --> 00:01:32,240 Let's rename our particle emitter to flash. 37 00:01:34,160 --> 00:01:38,570 Here we go and change some of the settings. 38 00:01:38,600 --> 00:01:45,590 I think I'm going to keep the color as white, and then I'll go to light emission. 39 00:01:46,160 --> 00:01:47,850 Let's make that one. 40 00:01:47,870 --> 00:01:52,010 That's going to give off some light and light influence. 41 00:01:52,190 --> 00:01:53,900 I'll just make that like 0.5. 42 00:01:56,000 --> 00:01:59,990 Size, we're going to make it smaller, maybe 0.5. 43 00:02:01,550 --> 00:02:02,590 Let's see. 44 00:02:02,600 --> 00:02:04,070 So you can change these textures. 45 00:02:04,070 --> 00:02:07,370 We have the sparkle, the default sparkle texture. 46 00:02:07,370 --> 00:02:08,420 I'm not going to change them. 47 00:02:08,420 --> 00:02:10,130 The sparkles fine for me. 48 00:02:10,130 --> 00:02:12,410 I'm going to go down a little more, though. 49 00:02:12,410 --> 00:02:18,230 So lifetime, if you have like 5 to 10, which is the default, you're going to get a random number 50 00:02:18,230 --> 00:02:19,870 between five and ten. 51 00:02:19,880 --> 00:02:23,540 I'm just going to make it a flat .05. 52 00:02:23,540 --> 00:02:26,600 So it's going to be a really real quick flash. 53 00:02:26,600 --> 00:02:30,470 Right now, you can still see that it's going upward. 54 00:02:31,070 --> 00:02:32,060 I don't want that. 55 00:02:32,060 --> 00:02:33,110 I'm going to skip over rate. 56 00:02:33,110 --> 00:02:37,730 We're going to turn that off because we're going to turn on each particle with code. 57 00:02:37,730 --> 00:02:41,060 So we don't want the rate at which the particles are firing. 58 00:02:41,060 --> 00:02:41,290 Right. 59 00:02:41,330 --> 00:02:42,530 We're going to make that zero. 60 00:02:42,530 --> 00:02:44,660 But I still want to see it while I'm working on it. 61 00:02:45,260 --> 00:02:46,190 Speed. 62 00:02:46,190 --> 00:02:53,930 I want to increase the speed to maybe at least 16 like a normal run, right? 63 00:02:54,020 --> 00:02:59,720 Because if we're running faster than the speed of the particle, we're not going to see it. 64 00:02:59,720 --> 00:03:01,670 It could go into the gun. 65 00:03:02,510 --> 00:03:04,970 So you may even want to make it faster than that. 66 00:03:05,420 --> 00:03:07,190 So one more configuration. 67 00:03:07,190 --> 00:03:13,430 We got that going out the top and I totally went right over it in mission direction. 68 00:03:14,350 --> 00:03:17,020 And it depends on which way front is on our attachment. 69 00:03:17,020 --> 00:03:20,140 We could change our attachment direction, but it's fine like this. 70 00:03:20,140 --> 00:03:25,130 We will try front and that's going the wrong way. 71 00:03:25,150 --> 00:03:28,950 So now let's do a mission direction back. 72 00:03:28,960 --> 00:03:30,430 That's the way I want it to go. 73 00:03:30,430 --> 00:03:32,440 So it's going out from the gun. 74 00:03:32,440 --> 00:03:36,430 We could just rotate the attachment, but it's fine like that. 75 00:03:36,520 --> 00:03:46,900 Now let's turn our rate to zero because we're going to fire those little particles off with code. 76 00:03:46,900 --> 00:03:48,850 Open the damage script. 77 00:03:49,690 --> 00:03:52,400 And we have some variables up at the top. 78 00:03:52,480 --> 00:03:57,190 Under the can shoot, let's get a reference to our particle emitter. 79 00:03:57,460 --> 00:03:58,360 Local. 80 00:03:58,360 --> 00:04:00,250 I'll call it flash. 81 00:04:00,790 --> 00:04:15,760 We'll do script dot parent dot gun part dot flash 80 for flash attachment flash Now go down to on shoot 82 00:04:15,940 --> 00:04:29,560 and if we can shoot we'll do we can do the game we can do the bang play and then do the flash emit one. 83 00:04:30,070 --> 00:04:31,180 There we go. 84 00:04:31,570 --> 00:04:35,860 Let's put this pistol in our starter pack so we don't have to fumble around in the world looking for 85 00:04:35,860 --> 00:04:36,280 it. 86 00:04:37,000 --> 00:04:37,900 Here we go. 87 00:04:37,900 --> 00:04:40,480 Starter pack and hit the play. 88 00:04:44,140 --> 00:04:45,340 We are in the world. 89 00:04:45,340 --> 00:04:46,990 Let's try our pistol. 90 00:04:47,260 --> 00:04:48,000 Nice. 91 00:04:48,010 --> 00:04:49,810 Let's look for Ayers view. 92 00:04:49,840 --> 00:04:50,790 Output. 93 00:04:50,800 --> 00:04:51,640 Looking good. 94 00:04:51,640 --> 00:04:53,050 I don't see any errors. 95 00:04:56,020 --> 00:04:58,120 And let's see how it is when we're running. 96 00:05:01,130 --> 00:05:02,750 Yeah, I'm good with that. 97 00:05:02,990 --> 00:05:06,710 All right, so now you have a muzzle flash you can play around with that. 98 00:05:06,710 --> 00:05:07,790 Can figure out how you want. 99 00:05:07,790 --> 00:05:13,220 Change the color, change the textures, change the speed, maybe add trails by shooting it out real 100 00:05:13,220 --> 00:05:13,850 quick. 101 00:05:13,850 --> 00:05:16,640 And I will see you in the next video.